package com.briup.web.controller;

import com.briup.pojo.User;
import com.briup.pojo.dto.UserLogin;
import com.briup.response.Result;
import com.briup.service.UserService;
import com.briup.utils.JwtUtil;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Api(tags = "用户登录接口")
@RestController
public class AuthController {

	@Autowired
	private UserService userService;

	/**
	 * 用户登录
	 * @param user
	 * @return
	 */
	@ApiOperation("用户登录")
	@PostMapping("/login")
	public Result<String> login(@RequestBody UserLogin user) {
		return Result.success(userService.login(user));
	}

	/**
	 * 退出登录
	 * @return
	 */
	@ApiOperation("退出登录")
	@PostMapping("/logout")
	public Result<String> logout() {
		return Result.success();
	}
}
